feat(asset): add asset categorization support (#298)#297
Conversation
Add the canonical two-level asset taxonomy to pyoaev so producers (collectors, custom integrations) can set the new categorization fields on endpoints: - new AssetCategory / AssetSubCategory / CloudProvider / AssetCriticality enums in pyoaev.asset_types, exported from the package - EndpointManager: endpoint_platform / endpoint_arch are now optional; add optional attrs asset_category, asset_subcategory, asset_criticality, asset_internet_facing, asset_cloud_provider, asset_cloud_native_type, asset_cloud_region, asset_metadata and endpoint_url - bump the package version Relates to OpenAEV-Platform/openaev#6452
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #297 +/- ##
==========================================
+ Coverage 73.58% 74.84% +1.25%
==========================================
Files 54 55 +1
Lines 2404 2512 +108
==========================================
+ Hits 1769 1880 +111
+ Misses 635 632 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds first-class asset categorization support to the Python client so endpoint producers can send the canonical (backend-aligned) asset taxonomy fields to OpenAEV.
Changes:
- Introduces
pyoaev.asset_typeswithAssetCategory,AssetSubCategory,CloudProvider, andAssetCriticalityenums and exports them frompyoaev. - Expands
EndpointManagerallowed create payload attributes to include asset categorization/cloud metadata fields and makes platform/arch optional. - Bumps package version and adds endpoint upsert tests for categorization payload serialization.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/apis/endpoint/test_endpoint.py | Adds tests asserting categorization fields are serialized on endpoint upsert calls. |
| pyoaev/asset_types.py | New module defining canonical asset taxonomy and related enums as str enums. |
| pyoaev/apis/endpoint.py | Updates endpoint create-attrs to support new categorization/cloud fields and relax platform/arch requirements. |
| pyoaev/init.py | Version bump and re-exports new enums from the package root. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…comment (#298) Address review feedback on the asset categorization PR: - endpoint.py: correct the _create_attrs comment to state that asset_name is the only required attribute and that endpoint_hostname / platform / arch are all optional (not just platform / arch). - test_endpoint.py: assert the upsert performs exactly one HTTP request (assert_called_once) and that a category-driven asset upsert sends no endpoint_platform / endpoint_arch on the wire.
Review and fix summaryReviewed the full changed files (not just the diff) and reconciled the PR with the repo conventions and CI. What was done:
Verification (local): CI: CircleCI build / test / linter / formatting, coverage, signed commits, linked issue and PR title are all green. Remaining (non-code blockers):
|
Follow-up review roundAddressed the latest Copilot comment on Verification: The thread is resolved and the branch is |
Summary
Adds the canonical two-level asset taxonomy to pyoaev so producers (collectors, custom integrations) can classify endpoints with the new fields introduced in OpenAEV.
Changes
pyoaev.asset_typesmodule withAssetCategory,AssetSubCategory,CloudProviderandAssetCriticalityenums, exported from the package.EndpointManager:asset_nameis now the only required attribute;endpoint_hostname,endpoint_platformandendpoint_archare optional (the platform defaults platform / arch toUnknownserver-side). Added optional attrsasset_category,asset_subcategory,asset_criticality,asset_internet_facing,asset_cloud_provider,asset_cloud_native_type,asset_cloud_region,asset_metadataandendpoint_url.Test plan
test/apis/endpoint/test_endpoint.py: upsert a web application without platform / arch and a cloud resource; assert the categorization fields are sent on the wire, that exactly one request is made, and that noendpoint_platform/endpoint_archis sent for a category-driven asset.Notes
_create_attrscomment to match the actual validation rules, and hardened both upsert tests withassert_called_once()plus an assertion that platform / arch are omitted.security/snyk (Filigran)check fails with a Snyk account quota error ("You have used your limit of private tests"), unrelated to this change. All other checks (CircleCI build / test / linter / formatting, coverage, signed commits, linked issue, PR title) are green.Related
Dependency of OpenAEV-Platform/openaev#6452 (asset categorization).
Closes #298